Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

community[patch]: change default Neo4j username/password #25226

Merged
merged 6 commits into from
Sep 3, 2024

Conversation

danodonovan
Copy link
Contributor

Description:

Change the default Neo4j username/password (when not supplied as environment variable or in code) from None to "".

Neo4j has an option to disable auth which is helpful when developing. When auth is disabled, the username / password through the neo4j module should be "" (ie an empty string).

Empty strings get marked as false in langchain_core.utils.env.get_from_dict_or_env -- changing this code / behaviour would have a wide impact and is undesirable.

In order to both allow access to Neo4j with auth disabled and not impact langchain_core this patch is presented. The downside would be that if a user forgets to set NEO4J_USERNAME or NEO4J_PASSWORD they would see an invalid credentials error rather than missing credentials error. This could be mitigated but would result in a less elegant patch!

Issue:
Fix issue where langchain cannot communicate with Neo4j if Neo4j auth is disabled.

Twitter handle: @danodonovan

@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Aug 9, 2024
Copy link

vercel bot commented Aug 9, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
langchain ⬜️ Ignored (Inspect) Visit Preview Sep 3, 2024 8:44am

@dosubot dosubot bot added community Related to langchain-community 🤖:improvement Medium size change to existing code to handle new use-cases labels Aug 9, 2024
@dosubot dosubot bot added the lgtm PR looks good. Use to confirm that a PR is ready for merging. label Aug 9, 2024
@jexp
Copy link
Contributor

jexp commented Aug 9, 2024

Hmm when auth is disabled, wouldn't it rather leave off the auth parameter in the driver?

Missing credentials is actually more helpful than "wrong credentials" here ... I can imagine searching for the bug e.g. a wrong path or a misspelled env variable for ages when it says wrong credentials instead of missing.

Copy link
Collaborator

@eyurtsev eyurtsev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"" credentials can be specified manually by the user, handled here with an if-else

@dosubot dosubot bot removed the lgtm PR looks good. Use to confirm that a PR is ready for merging. label Aug 9, 2024
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Aug 9, 2024
@danodonovan
Copy link
Contributor Author

@jexp @eyurtsev thank you for the feedback, I agree. 6a60dad follows jexp suggestion to remove auth from the driver if "" is intentionally provided

@danodonovan
Copy link
Contributor Author

@eyurtsev @jexp Sorry for pushing this PR past you again, the changes would be helpful for me if accepted.

@baskaryan
Copy link
Collaborator

cc @tomasonjo

@tomasonjo
Copy link
Contributor

tomasonjo commented Aug 29, 2024 via email

@hwchase17
Copy link
Contributor

needs to be formatted, otherwise lgtm

@danodonovan
Copy link
Contributor Author

needs to be formatted, otherwise lgtm

Thanks @hwchase17 -- sorry to have missed the linting issue, it should be green-lit now

@efriis efriis merged commit f49da71 into langchain-ai:master Sep 3, 2024
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Related to langchain-community 🤖:improvement Medium size change to existing code to handle new use-cases size:S This PR changes 10-29 lines, ignoring generated files.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

8 participants